home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CMDLINE.SWG / 0003_Get Command Line #2.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  31 lines

  1. {
  2.  In TP there is, of course, ParamCount and ParamStr.
  3.  
  4.  The actual command line can be found in the PSP segment, at offset
  5.  $80 (hexadecimal).  The Byte at $80 contains the count of Characters,
  6.  including the leading delimiter Character (usually a space).
  7.  
  8.  In TP the PSP segment may be accessed using PrefixSeg.  Note that TP
  9.  omits the carriage-return that normally appends the input Character
  10.  line.  This is a problem For Programs that look For it as the end of
  11.  the String.
  12.  
  13.  If you're using a non-TP compiler, you'll need to get the PSP segment
  14.  value via a Dos Function $62 call.
  15.  
  16.  Here's a simple TP Program to illustrate.  Compile it, then invoke
  17.  it With some command-line input...
  18. }
  19. (*********************************************************************)
  20. Program CommandLine;    { CL.PAS }
  21. Var
  22.   CharCount, i : Word;
  23. begin
  24.   CharCount := Mem[PrefixSeg:$80];  { number of input Characters }
  25.   WriteLn('Input Characters: ', CharCount );
  26.   For i := 1 to CharCount DO
  27.     Write( CHR( Mem[PrefixSeg:$80+i] ));
  28.   WriteLn;
  29. end.
  30. (*********************************************************************)
  31.